<?php
namespace Admin\Model;
use Think\Model;
/**
 * Created by hanquan.
 * User: Administrator
 * Date: 2017/3/26
 * Time: 15:30
 * BrandModel 手机品牌类
 */

class BrandModel extends Model {

	private $Brand = null;

	function __construct(){
		$this->Brand = M('Brand');
	}

	/**
     * 获取手机品牌
     */
	public function get_brand(){
		$condition['b_status'] = 1;
		return $this->Brand->field('bid,b_name')->where($condition)->select();
	}

	/**
     * 插入或修改手机品牌
     * @data 提交手机品牌的数据
     * @bid 手机品牌id
     */
	public function set_brand($data,$bid=FALSE){

		if(!$bid){
			return $this->Brand->add($data);
		}else{
			$condition['bid'] = $bid;
			return $this->Brand->where($condition)->save($data);
		}
	}

}